package net.vmiranda.jeds.web.tareas;

import java.util.List;

import net.vmiranda.jeds.core.tareas.BusquedaTarea;
import net.vmiranda.jeds.core.tareas.ResultadoConsultaTarea;
import net.vmiranda.jeds.core.tareas.TareasManager;
import net.vmiranda.jeds.utils.modulos.DataModel;

public class DataModelTareas extends DataModel<ResultadoConsultaTarea> {
	
	private TareasManager tm;
	private BusquedaTarea busqueda;
	
	public DataModelTareas(int elementosPorPagina, BusquedaTarea busqueda){
		super(elementosPorPagina);
		tm = new TareasManager();
		this.busqueda = busqueda;
	}

	@Override
	public List<ResultadoConsultaTarea> consulta(int start, int length) {
		if(tm == null){tm = new TareasManager();}
		List<ResultadoConsultaTarea> tareas = tm.listarTareas("victormirandabeltran@gmail.com",busqueda,start,length);
		return tareas;
	}

	@Override
	public long numeroElementos() {
		if(tm == null){tm = new TareasManager();}
		return tm.numeroTareas("victormirandabeltran@gmail.com");
	}

}
